# Bazel (http://bazel.io/) workspace file.
#
# Where the SHA-256 checksums are needed, these can be generated using the
# `sha256sum` tool on Unix platforms (found as part of `coreutils` package
# in most Linux distributions).

workspace(name = "com_google_persoarabic")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# -------------------------------------------------------------------------
# Core Python rules.
# -------------------------------------------------------------------------

rules_python_version = "0.10.2"

http_archive(
    name = "rules_python",
    url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/%s.tar.gz" % (
        rules_python_version),
    strip_prefix = "rules_python-%s" % rules_python_version,
    sha256 = "a3a6e99f497be089f81ec082882e40246bfd435f52f4e82f37e89449b04573f6",
)

# -------------------------------------------------------------------------
# gRPC for fresh `python_configure`.
# -------------------------------------------------------------------------

grpc_version = "1.48.0"

http_archive(
    name = "com_github_grpc_grpc",
    sha256 = "20e02152bc63c53dd9148325d32b2fac4d38e74e86d832fb7950452c00a52faa",
    strip_prefix = "grpc-%s" % grpc_version,
    url = "https://github.com/grpc/grpc/archive/refs/tags/v%s.zip" % grpc_version,
)

load("@com_github_grpc_grpc//third_party/py:python_configure.bzl", "python_configure")

python_configure(name = "local_config_python")

# -------------------------------------------------------------------------
# External Python packages.
# -------------------------------------------------------------------------

# Python external packages installation.
load("@rules_python//python:pip.bzl", "pip_install")

pip_install(
    name = "all_deps",
    requirements = "//:requirements.txt", # Top level requirements.
)

# -------------------------------------------------------------------------
# Google protocol buffers. See
#    https://github.com/protocolbuffers/protobuf
# -------------------------------------------------------------------------
protobuf_version = "3.19.4"
protobuf_sha256 = "3bd7828aa5af4b13b99c191e8b1e884ebfa9ad371b0ce264605d347f135d2568"

http_archive(
    name = "com_google_protobuf",
    sha256 = protobuf_sha256,
    strip_prefix = "protobuf-%s" % protobuf_version,
    urls = ["https://github.com/protocolbuffers/protobuf/archive/v%s.tar.gz" %
            protobuf_version],
)

# Import external protobuf dependencies into this workspace.
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
protobuf_deps()

# -------------------------------------------------------------------------
# Thrax: This repo is only used to retrieve some of the build rules for
# grammar manipulation. See
#    http://www.opengrm.org/twiki/bin/view/GRM/Thrax
# -------------------------------------------------------------------------
thrax_version = "1.3.7-rc1"

http_archive(
    name = "org_opengrm_thrax",
    urls = ["https://github.com/agutkin/finite_state/raw/main/thrax-%s.tar.gz" % thrax_version],
    sha256 = "8708b4822ed12d6ab35b6177436e0fec6e041259df7b6f7949f0bc46ad23285b",
    strip_prefix = "thrax-%s" % thrax_version,
)

# -------------------------------------------------------------------------
# Pynini: See
#    http://www.opengrm.org/twiki/bin/view/GRM/Pynini
# -------------------------------------------------------------------------
pynini_version = "2.1.5-rc1"

http_archive(
    name = "org_opengrm_pynini",
    urls = ["https://github.com/agutkin/finite_state/raw/main/pynini-%s.tar.gz" % pynini_version],
    sha256 = "2ddfa9dc76c7d47b4999f9c59426a79f40e3db480c87ecd307f5d7413e78cb63",
    strip_prefix = "pynini-%s" % pynini_version
)

load("@org_opengrm_pynini//bazel:workspace.bzl", "pynini_repositories")

pynini_repositories()

# -------------------------------------------------------------------------
# Nisaba: Latest head.
# -------------------------------------------------------------------------

http_archive(
    name = "com_google_nisaba",
    url = "https://github.com/google-research/nisaba/archive/refs/heads/main.zip",
    sha256 = "fc00189dd0b5248109c6d10179a03e1d5ead0eec9873e8166ef595eaa3b2d04b",
    strip_prefix = "nisaba-main",
)

load("@com_google_nisaba//bazel:workspace.bzl", "nisaba_public_repositories")

nisaba_public_repositories()

pip_install(
    name = "nisaba_deps",
    requirements = "@com_google_nisaba//:requirements.txt", # Top level requirements.
)
